package com.shuaibiao.entity.base;

public class PageObject {
	
	/**
	 * 当前页
	 */
	private Integer page;
	/**
	 * 规定显示条数
	 */
	private Integer limit;
	/**
	 * 总数
	 */
	private Integer count;
	/**
	 * 总页数
	 */
	private Integer totalPage;
	
	/**
	 * @param page
	 * @param limit
	 * @param count
	 * @param start
	 */
	public PageObject(Integer page, Integer limit, Integer count) {
		super();
		this.page = page;
		this.limit = limit;
		this.count = count;
		if(this.page==null){
			this.page = 1;
		}
		if(this.limit == null){
			this.limit = 10;
		}
		//计算总页数
		this.totalPage = (this.count+this.limit-1)/this.limit;
		//判断当前页数是否超出范围
		//不能小于1
		if(this.page<1){
			this.page = 1;			
		}
		if(this.page>this.count){
			this.page = this.count;
		}		
	}
	
	public int getStart(){
		return (this.page-1)*this.limit;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getLimit() {
		return limit;
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	
	

}
